<template>
  <div>
    <h4>子组件 - {{ num }} {{ str }}</h4>
    <button @click="changeNum">改数字</button>
    <button @click="changeStr">改str</button>
  </div>
</template>

<script>
export default {
  props: {
    num: {
      type: Number,
      default: 0
    },
    str: {
      type: String,
      default: ''
    }
  },
  methods: {
    changeNum() {
      // this.$emit('changeNum', 10)
      this.$emit('update:num', 10)
    },
    changeStr() {
      this.$emit('update:str', 'abc')
    }
  }
}
</script>

<style>

</style>
